#include <stdio.h>

void input(char a[][100], char b[][100], int c[][100], int c1[][100], int c2[][100], int N)
{
    for(int i = 0; i < N; i++)
    {
        scanf("%s %s %d %d %d", a[i], b[i], &c[i][0], &c1[i][0], &c2[i][0]);
    }
}

void print(char a[][100], char b[][100], int c[][100], int c1[][100], int c2[][100], int N)
{
    for(int i = 0; i < N; i++)
    {
        printf("%s %s %d %d %d\n", a[i], b[i], c[i][0], c1[i][0], c2[i][0]);
    }
}

int main()
{
    int N;
    scanf("%d", &N);
    char a[100][100], b[100][100];
    int c[100][100], c1[100][100], c2[100][100];
    input(a, b, c, c1, c2, N);
    print(a, b, c, c1, c2, N);
    return 0;
}
